<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="thx" uri="/thx-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
		
<div class="row">
	<div class="col-md-12">
		<div class="box">
			<div class="box-header with-border">
				<div class="row">
					<form class="search-panel" name="search-form" result-container=".tab-content .active">
						<input type="text" name="entity.workTitle" value="${entity.workTitle}" class="form-control" placeholder="标题名">
						<input type="hidden" name="appId" value="${appId}"/>
						<input type="hidden" name="entity.workType" value="${entity.workType}"/>
						<input type="hidden" name="state" value="${state}" id="state"/>
						<input type="hidden" name="officeDocTypeAppIds" value="${officeDocTypeAppIds}"/>
						<button type="button" class="btn btn-primary search-btn">搜索</button>
					</form>
				</div>
			</div>
			<div class="box-body no-padding">
				<div class="row">
					<div class="col-sm-12">
						<table class="table table-bordered">
							<tr>
								<s:if test="entity.workType!=null && entity.workType=='document'">
									<th>文件名称</th>
									<th>公文类型</th>
									<th>主办单位</th>
									<th>起草时间</th>
									<th>结束时间</th>
									<th>当前状态</th>
								</s:if>
								<s:else>
									<th>标题</th>
									<th>应用名称</th>
									<th>发起人</th>
									<th>起草时间</th>
									<th>结束时间</th>
									<th>当前状态</th>
								</s:else>
							</tr>
							<c:if test="${empty list}">
								<tr>
									<td colspan="6">暂无数据！</td>
								</tr>
							</c:if>
							<c:forEach items='${list}' var="work">
								<tr>
									<td><a target="_blank"  showname="${work.workTitle }"
										 href="${pageContext.request.contextPath}/jbpmService/work/getWorkByWorkId?workId=${work.workId }">
										 	<span title="${work.workTitle}" style="width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; text-align: center;display: inline-block;">${work.workTitle}</span>
										</a>
									</td>
									<td>${work.appName }&nbsp;</td>
									<td>${work.starterName }&nbsp;</td>
									<td><fmt:formatDate value="${work.startTime }" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;</td>
									<td><fmt:formatDate value="${work.endTime }" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;</td>
									<td>
									 	<span title="${work.curActivityName}" style="width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; text-align: center;display: inline-block;">${work.curActivityName}</span>
									</td>
								</tr>
							</c:forEach>
						</table>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<!--分页区-->
				<div class="pagePanel">
					<thx:pages pageNo="page.curPage" total="page.totalPage" theme="number">
						<s:param name="entity.workTitle" value="entity.workTitle"></s:param>
					 	<s:param name="entity.workType" value="entity.workType"></s:param>
					 	<s:param name="appId" value="appId"></s:param>
					 	<s:param name="state" value="state"></s:param>
					 	<s:param name="officeDocTypeAppIds" value="officeDocTypeAppIds"></s:param>
					</thx:pages>
				</div>
			</div>
		</div>
	</div>
</div>				
<script type="text/javascript">
	$( function() {
		list.init();
		page.init(".tab-content .active");
		
		if($("#state").val()!='running'){
			$("#search").attr("action","./haveTodo!list.action");
		}else{
	  		$("#search").attr("action","./haveTodo!haveTodoRunWork.action");				
		}
	});
</script>